<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>会员信息查询</title>
    <link href="../../static/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../../static/js/jquery-2.1.4.min.js"></script>
    <!-- 引入vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.1"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".click").click(function () {
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function () {
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function () {
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function () {
                $(".tip").fadeOut(100);
            });

        });
    </script>
</head>

<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li>首页</li>
        <li>入住管理</li>
        <li>入住信息查询</li>
    </ul>
</div>
<div class="rightinfo">
    <div class="tools">
<!--        <ul class="toolbar">
            <li class="click"><span><img src="../../static/images/t01.png"/></span>添加</li>
            <li class="click"><span><img src="../../static/images/t02.png"/></span>修改</li>
            <li><span><img src="../../static/images/t03.png"/></span>删除</li>
        </ul>-->
        <div class="toolbar1">
            <table>
                <form method="get" name="serch">
                    <tr>
                        <td class="zi"><span>选择分类：</span></td>
                        <td><select v-model="conditionType">
                            <option value="vipNum">会员卡号</option>
                            <option value="customerName">会员姓名</option>
                            <option value="phone">手机号码</option>
                            <option value="idcard">身份证号码</option>
                        </select></td>
                        <td class="zi"><span>关键字：</span></td>
                        <td><input v-model="keyword" type="text" placeholder="与分类关联"/></td>
                        <td><input type="submit" value="查询" class="button" @click="getByCon"/></td>
                    </tr>
                </form>
            </table>
        </div>
    </div>
    <table class="tablelist">
        <thead>
        <tr>
            <th><input name="" type="checkbox" value="" checked="checked"/></th>
            <th>编号</th>
            <th>会员卡号</th>
            <th>会员姓名</th>
            <th>性别</th>
            <th>身份证号码</th>
            <th>手机号码</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(map,index) in vipList.list">
            <td><input name="" type="checkbox" value=""/></td>
            <td>{{index + 1}}</td>
            <td>{{map.vipNum}}</td>
            <td>{{map.customerName}}</td>
            <td>{{map.gender==true?'男':'女'}}</td>
            <td>{{map.idcard}}</td>
            <td>{{map.phone}}</td>
            <td><a href="javascript:(0);" class="tablelink" @click="deleteVip(map.id)"> 删除</a></td>
        </tr>

        </tbody>
    </table>
    <div class="pagin">
        <div class="message">共<i class="blue">{{vipList.total}}</i>条记录，当前显示第&nbsp;<i class="blue">{{vipList.pageNum}}&nbsp;</i>页
        </div>
        <ul class="paginList">
            <li class="paginItem" ><a href="javascript:(0);" @click="findPage(vipList.firstPage)"><span class="pagepre">首页</span></a></li>
            <li class="paginItem" style="width: 50px"><a href="javascript:(0);" @click="findPage(vipList.pageNum==vipList.firstPage?vipList.firstPage:vipList.prePage)"><span class="pagepre">前一页</span></a></li>
            <li class="paginItem" style="width: 50px"><a href="javascript:(0);" @click="findPage(vipList.pageNum==vipList.lastPage?vipList.lastPage:vipList.nextPage)"><span class="pagenxt">下一页</span></a></li>
            <li class="paginItem"><a href="javascript:(0);" @click="findPage(vipList.lastPage)"><span class="pagenxt">末页</span></a></li>
        </ul>
    </div>
    <div class="tip">
        <div class="tiptop"><span>提示信息</span><a></a></div>
        <div class="tipinfo"><span><img src="../../static/images/ticon.png"/></span>
            <div class="tipright">
                <p>是否确认对信息的修改 ？</p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite></div>
        </div>
        <div class="tipbtn">
            <input name="" type="button" class="sure" value="确定"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    var vue = new Vue({
        el: ".rightinfo",
        data: {
            vipList: [],
            conditionType: '',
            keyword: ''
        },
        methods: {
            getByCon() {
                var param = {
                    conditionType: this.conditionType,
                    keyword: this.keyword
                }
                this.$http.post("/getVip.do", param).then(
                    function (rs) {
                        this.vipList = rs.data;
                    }
                );
            },
            findPage(pageNum) {
                var param = {
                    conditionType: this.conditionType,
                    keyword: this.keyword
                }
                this.$http.post("/getVip.do?pageNum=" + pageNum, param).then(
                    function (rs) {
                        this.vipList = rs.data;
                    }
                );
            },
            deleteVip(id) {
                this.$http.post("/deleteVip.do?id=" + id).then(
                    function (rs) {
                        if (rs.data) {
                            window.location.href = "vip.html";
                        } else {
                            window.alert("删除失败，请重试");
                        }
                    },
                    function (err) {
                        window.alert("数据请求失败");
                    }
                );
            }
        },
        mounted() {
            var param = {
                conditionType: this.conditionType,
                keyword: this.keyword
            }
            this.$http.post("/getVip.do", param).then(
                function (rs) {
                    this.vipList = rs.data;
                }
            );
        }
    })
</script>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
